#include "graph.h"
int main()
{
    Graph * graph=new Graph(9);
    graph->addEdge(0,1,4);
    graph->addEdge(0,7,8);
    graph->addEdge(1,7,11);
    graph->addEdge(1,2,8);
    graph->addEdge(7,8,7);
    graph->addEdge(6,7,1);
    graph->addEdge(6,8,6);
    graph->addEdge(2,8,2);
    graph->addEdge(2,5,4);
    graph->addEdge(2,3,7);
    graph->addEdge(5,6,2);
    graph->addEdge(3,5,14);
    graph->addEdge(3,4,9);
    graph->addEdge(4,5,10);
    //graph->printMap();
    list<Edge> *res=graph->kruskal();
    list<Edge>::iterator iter;
    for(iter=res->begin();iter!=res->end();iter++)
    {
        cout<<*iter<<endl;
    }
    delete res;
    delete graph;
    Graph * graph2=new Graph(9);
    graph2->addEdge(0,1,4);
    graph2->addEdge(0,7,8);
    graph2->addEdge(1,7,11);
    graph2->addEdge(1,2,8);
    graph2->addEdge(7,8,7);
    graph2->addEdge(6,7,1);
    graph2->addEdge(6,8,6);
    graph2->addEdge(2,8,2);
    graph2->addEdge(2,5,4);
    graph2->addEdge(2,3,7);
    graph2->addEdge(5,6,2);
    graph2->addEdge(3,5,14);
    graph2->addEdge(3,4,9);
    graph2->addEdge(4,5,10);
    //graph2->printMap();
    res=graph2->prim();
    cout<<endl;
    for(iter=res->begin();iter!=res->end();iter++)
    {
        cout<<*iter<<endl;
    }
    delete graph2;
    delete res;
    return 0;
}
